package com.sambo.inspection.activity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.sambo.inspection.R;
import com.sambo.inspection.activity.support.BaseActivity;
import com.sambo.inspection.bean.MessageBean;

public class MessageDetailActivity extends BaseActivity {

    ImageView ivBack;
    ImageView ivTitleImg;
    TextView tvMsgTitle;
    TextView tvMsgDate;
    TextView tvMsgContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message_detail);

        ivBack = findViewById(R.id.iv_back);
        ivTitleImg = findViewById(R.id.iv_title_img);
        tvMsgTitle = findViewById(R.id.tv_msg_title);
        tvMsgDate = findViewById(R.id.tv_msg_date);
        tvMsgContent = findViewById(R.id.tv_msg_content);

        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        MessageBean bean = (MessageBean) getIntent().getSerializableExtra("msgModel");

        if (bean != null) {
            tvMsgTitle.setText(bean.getTitle());
            if (!TextUtils.isEmpty(bean.getCreateDate())) {
                tvMsgDate.setText("发布于:" + bean.getCreateDate());
            }
            tvMsgContent.setText(bean.getContent());
            if (TextUtils.equals("1", bean.getImportance())) {
                ivTitleImg.setVisibility(View.VISIBLE);
            }
        }

    }

}
